package com.dietdroid;
/*
 * SearchActivity.java
 * Author : Brian Adams
 * 
 * This class is for the search activity screen
 */
import com.dietdroid.R;
import com.google.zxing.integration.android.IntentIntegrator;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableRow;

public class SearchActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search_activity);
        
       
        
        Button searchButton = (Button) findViewById(R.id.buttonSearch);
        searchButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
            	Bundle b = new Bundle();
            	String userInput = ((EditText)findViewById(R.id.editText)).getText().toString();
            	if(userInput.equals("")) {
            		return;
            	}
            	b.putString("userInput",userInput);
            	b.putString("barcode", userInput);
    			Intent resultsList = new Intent(SearchActivity.this, ResultListActivity.class);
    			resultsList.putExtras(b);
    			startActivity(resultsList);
            }

        });
    }
    
    
}
